package serach;

public class BM18 {
    public static boolean Find(int target, int [][] array) {
         int i = 0;
         int j = array[0].length-1;
         while (i<array.length&&j>=0)
         {
             if((i<array.length&&j>=0)&&target==array[i][j])
             {
                 return true;
             }
             if((i<array.length&&j>=0)&&array[i][j]<target)
             {
                 i++;
             }
             if((i<array.length&&j>=0)&&array[i][j]>target)
             {

                 j--;
             }
         }

        return false;
    }

    public static void main(String[] args) {
        int [][]num={
                {1,1},
        };
        Find(2,num);
    }
}
